package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.pojo.TSetmeal;
import com.qf.service.TSetmealService;
import com.qf.mapper.TSetmealMapper;
import com.qf.utils.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【t_setmeal】的数据库操作Service实现
* @createDate 2024-07-17 22:33:27
*/
@Service
@RequiredArgsConstructor
public class TSetmealServiceImpl extends ServiceImpl<TSetmealMapper, TSetmeal>
    implements TSetmealService{
    private final TSetmealMapper setmealMapper;
    @Override
    public Result listSetmealPage(int page, int pageSize, String queryString) {
        LambdaQueryWrapper<TSetmeal> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(StringUtils.hasText(queryString),TSetmeal::getName,queryString)
                .or().like(StringUtils.hasText(queryString),TSetmeal::getCode,queryString)
                .or().like(StringUtils.hasText(queryString),TSetmeal::getHelpcode,queryString);

        Page<TSetmeal> p = new Page<>(page,pageSize);
        Page<TSetmeal> tSetmealPage = setmealMapper.selectPage(p, wrapper);
        return new Result(true,"查询成功",tSetmealPage);
    }

    @Override
    public void add(List<String> checkgroupIds, TSetmeal setmeal) {
        //TODO 添加套餐没写完
       // setmealMapper.
    }
}




